package com.ssy.lingxi.marketing.controller.activity;

import com.ssy.lingxi.common.constant.marketing.BelongTypeEnum;
import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.marketing.model.vo.activity.request.ActivityExecutePageReq;
import com.ssy.lingxi.marketing.model.vo.activity.request.MerchantActivityCommonPageVO;
import com.ssy.lingxi.marketing.model.vo.activity.request.PfActivityGoodsPageReq;
import com.ssy.lingxi.marketing.model.vo.activity.request.PfActivitySignUpPageReq;
import com.ssy.lingxi.marketing.model.vo.activity.response.*;
import com.ssy.lingxi.marketing.model.vo.common.request.CommonIdReq;
import com.ssy.lingxi.marketing.service.IActivityExecuteService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @menu 营销能力 - 营销活动执行
 *
 * @author ds
 * @version 2.0.0
 * @date 2021/12/23
 */
@RestController
@RequestMapping("/marketing/ability/activity/execute")
public class MerchantActivityExecuteController extends BaseController {

    @Resource
    private IActivityExecuteService activityExecuteService;

    /**
     * 商家营销活动执行 - 分页列表
     */
    @RequestMapping(value = "/merchant/page", method = RequestMethod.GET)
    public Wrapper<PageData<MerchantActivityExecutePageResp>> pageMerchant(@Valid MerchantActivityCommonPageVO pageReq) {
        return activityExecuteService.pageMerchant(getSysUser(), pageReq);
    }

    /**
     * 商家营销活动执行 - 活动详情
     */
    @GetMapping(value = "/merchant/detail")
    public Wrapper<MerchantActivityDetailResp> detailMerchant(CommonIdReq req) {
        return activityExecuteService.detailMerchant(getSysUser(), req);
    }

    /**
     * 商家营销活动执行 - 活动详情 - 活动商品(分页)
     */
    @RequestMapping(value = "/merchant/detail/goods/page", method = RequestMethod.GET)
    public Wrapper<PageData<ActivityExecuteGoodsPageResp>> pageByActivityGoodsMerchant(@Valid PfActivityGoodsPageReq req) {
        return activityExecuteService.pageByActivityGoodsMerchant(getSysUser(), req);
    }

    /**
     * 商家营销活动执行 - 活动详情 - 活动商品-执行明细(分页)
     */
    @RequestMapping(value = "/merchant/detail/goods/execute/detail/page", method = RequestMethod.GET)
    public Wrapper<PageData<ActivityExecuteDetailPageResp>> pageMerchantExecuteDetailOfAbility(@Valid ActivityExecutePageReq req) {
        req.setBelongType(BelongTypeEnum.MERCHANT.getCode());
        return activityExecuteService.pageMerchantExecuteDetailOfAbility(getSysUser(), req);
    }

    /**
     * 平台营销活动执行 - 分页列表
     */
    @RequestMapping(value = "/platform/page", method = RequestMethod.GET)
    public Wrapper<PageData<PlatformActivityExecuteAbilityPageResp>> pagePlatformOfAbility(@Valid PfActivitySignUpPageReq pageReq) {
        return activityExecuteService.pagePlatformOfAbility(getSysUser(), pageReq);
    }

    /**
     * 平台营销活动执行 - 活动详情
     */
    @GetMapping(value = "/platform/detail")
    public Wrapper<PlatformActivityDetailResp> detailPlatformOfAbility(CommonIdReq req) {
        return activityExecuteService.detailPlatformOfAbility(getSysUser(), req);
    }

    /**
     * 平台营销活动执行 - 活动详情 - 活动商品(分页)
     */
    @RequestMapping(value = "/platform/detail/goods/page", method = RequestMethod.GET)
    public Wrapper<PageData<ActivityExecuteGoodsPageResp>> pageByActivityGoodsPlatformOfAbility(@Valid PfActivityGoodsPageReq req) {
        return activityExecuteService.pageByActivityGoodsPlatformOfAbility(getSysUser(), req);
    }

    /**
     * 平台营销活动执行 - 活动详情 - 活动商品-执行明细(分页)
     */
    @RequestMapping(value = "/platform/detail/goods/execute/detail/page", method = RequestMethod.GET)
    public Wrapper<PageData<ActivityExecuteDetailPageResp>> pagePlatformExecuteDetailOfAbility(@Valid ActivityExecutePageReq req) {
        req.setBelongType(BelongTypeEnum.PLATFORM.getCode());
        return activityExecuteService.pageMerchantExecuteDetailOfAbility(getSysUser(), req);
    }
}
